package com.blackcat.annotation.bean;

import com.blackcat.annotation.bean.bean.User;
import com.blackcat.annotation.bean.config.MyConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {

    public static void main(String[] args) {
        // 容器中读取Bean
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.class);
//        System.out.println(ctx.getBean("user"));
//        System.out.println(ctx.getBean("user1"));
//        System.out.println(ctx.getBean("user3"));

        /*User prototype1 = (User) ctx.getBean("user4");
        User prototype2 = (User) ctx.getBean("user4");
        System.out.println(prototype1.getClass());
        System.out.println(prototype2.getClass());*/

        /*User user1 = (User) ctx.getBean("user4");
        User user2 = (User) ctx.getBean("user4");
        System.out.println(user1==user2);*/
        ctx.close();
    }
}
